package cn.itlaobing.springbootdemo.service.task;

import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;

@Component
public class MyTask {
    private Log log= LogFactory.getLog(this.getClass());


    @Scheduled(fixedRate = 5000)
    public void taskOne()  {
        long begin=System.currentTimeMillis();
        log.info("[任务一] begin......"+begin);
        try {
            Thread.sleep(500);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
        long end=System.currentTimeMillis();
        log.info("[任务一] end....耗时:"+(end-begin) +"....."+end);

    }

}
